/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author userlab05
 */
@Entity
@Table(name = "semestre")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Semestre.findAll", query = "SELECT s FROM Semestre s"),
    @NamedQuery(name = "Semestre.findByIdSemestre", query = "SELECT s FROM Semestre s WHERE s.idSemestre = :idSemestre"),
    @NamedQuery(name = "Semestre.findBySemestre", query = "SELECT s FROM Semestre s WHERE s.semestre = :semestre"),
    @NamedQuery(name = "Semestre.findByA\u00f1o", query = "SELECT s FROM Semestre s WHERE s.a\u00f1o = :a\u00f1o"),
    @NamedQuery(name = "Semestre.findByAnulado", query = "SELECT s FROM Semestre s WHERE s.anulado = :anulado")})
public class Semestre implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idSemestre")
    private Integer idSemestre;
    @Basic(optional = false)
    @Column(name = "semestre")
    private short semestre;
    @Basic(optional = false)
    @Column(name = "a\u00f1o")
    @Temporal(TemporalType.DATE)
    private Date año;
    @Column(name = "anulado")
    private Boolean anulado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "semestreidSemestre")
    private Collection<Asignacionseccioncurso> asignacionseccioncursoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "semestreidSemestre")
    private Collection<Horarioaula> horarioaulaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "semestreidSemestre")
    private Collection<Horariocurso> horariocursoCollection;

    public Semestre() {
    }

    public Semestre(Integer idSemestre) {
        this.idSemestre = idSemestre;
    }

    public Semestre(Integer idSemestre, short semestre, Date año) {
        this.idSemestre = idSemestre;
        this.semestre = semestre;
        this.año = año;
    }

    public Integer getIdSemestre() {
        return idSemestre;
    }

    public void setIdSemestre(Integer idSemestre) {
        this.idSemestre = idSemestre;
    }

    public short getSemestre() {
        return semestre;
    }

    public void setSemestre(short semestre) {
        this.semestre = semestre;
    }

    public Date getAño() {
        return año;
    }

    public void setAño(Date año) {
        this.año = año;
    }

    public Boolean getAnulado() {
        return anulado;
    }

    public void setAnulado(Boolean anulado) {
        this.anulado = anulado;
    }

    @XmlTransient
    public Collection<Asignacionseccioncurso> getAsignacionseccioncursoCollection() {
        return asignacionseccioncursoCollection;
    }

    public void setAsignacionseccioncursoCollection(Collection<Asignacionseccioncurso> asignacionseccioncursoCollection) {
        this.asignacionseccioncursoCollection = asignacionseccioncursoCollection;
    }

    @XmlTransient
    public Collection<Horarioaula> getHorarioaulaCollection() {
        return horarioaulaCollection;
    }

    public void setHorarioaulaCollection(Collection<Horarioaula> horarioaulaCollection) {
        this.horarioaulaCollection = horarioaulaCollection;
    }

    @XmlTransient
    public Collection<Horariocurso> getHorariocursoCollection() {
        return horariocursoCollection;
    }

    public void setHorariocursoCollection(Collection<Horariocurso> horariocursoCollection) {
        this.horariocursoCollection = horariocursoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSemestre != null ? idSemestre.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Semestre)) {
            return false;
        }
        Semestre other = (Semestre) object;
        if ((this.idSemestre == null && other.idSemestre != null) || (this.idSemestre != null && !this.idSemestre.equals(other.idSemestre))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Semestre[ idSemestre=" + idSemestre + " ]";
    }
    
}
